#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<cstdlib>//rand()
#define rep(i,a,b) for(register int i = (a);i <= (b);++i)
#define per(i,a,b) for(register int i = (a);i >= (b);--i)
typedef long long ll;
typedef unsigned long long ull;
using std::string;using std::cin;using std::cout;

int n,p,a[111111];
bool flag[111111];

int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("in.in", "r", stdin);
    cin >> n;
    rep(i,1,n){
        cin >> a[i];
        flag[a[i]] = true;
    }
    if(a[1] == 1) flag[0] = true;
    a[0] = 0;
    rep(i,1,n){
        if(a[i] == a[i-1]){
            while(p <= n+1 && flag[p]) ++p;
            flag[p] = true;
            cout << p << " ";
        } else cout << a[i-1] << " ";
    }

    return 0;
}